package reactor3;

import reactor.core.publisher.Flux;
import reactor.core.scheduler.Schedulers;

/**
 * @program: util
 * @description:
 * @author: zhouliangliang
 * @create: 2020-02-28 12:50
 **/
public class Test {

    public void test() {
        String []array = new String[]{"1","2"};
        Flux.fromArray(array)
                .map(city ->{
                    if(city.equalsIgnoreCase("1")) {
                        return true;
                    }
                    return false;
                })
                .parallel()
                .runOn(Schedulers.parallel())
                .sequential()
                .collectList()
                .subscribe(result ->{
                    System.out.println(result.size());
                });
//                .publishOn(Schedulers.single())
//                .reduce((a,b) -> a && b)
//                .log()
//                .subscribe(result ->{
//                    System.out.println("aaaa");
//                    System.out.println(result);
//                });
    }

    public static void main(String[] args) {
        new Test().test();
    }
}
